const {newMusic,hotMusic,dj} = require("../../models/home")
const {titles,icons} = require("../../static/data")
Page({
  data:{
    lists:""
  },
  onLoad:async function(){
    let lists = {};
    let https = [newMusic,hotMusic,dj];
    /* let titles = {
      newMusic:"最新音乐",
      hotMusic:"热门音乐",
      dj:"主播电台"
    }
    let icons = {
      newMusic:"/images/remen.png",
      hotMusic:"/images/zuixin.png",
      dj:"/images/zhubo.png"
    } */
    for (let item of https){
      let res = await item();
      // console.log(res);
      // console.log(https);
      // console.log(item.name);
      // console.log(res.data.playlists);
      lists[item.name] = {
        res:res.data.playlists.slice(0,3),
        title:titles[item.name],
        iconUrl:icons[item.name]
      }
    }
    this.setData({
      lists
    })
  }
})
